# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Sébastien Luttringer <seblu@aur.archlinux.org>

pkgname=lynis
pkgver=3.0.9
pkgrel=1
pkgdesc='Security and system auditing tool to harden Unix/Linux systems'
url='https://cisofy.com/lynis/'
arch=('any')
license=('GPL3')
backup=('etc/lynis/default.prf')
depends=('sh' 'awk')
optdepends=('net-tools: networking tests'
            'bind-tools: nameserver tests'
            'iptables: firewall tests')
source=("https://downloads.cisofy.com/lynis/lynis-$pkgver.tar.gz"{,.asc})
sha512sums=('7fc0349be9ea9d6e311b834cb7f9089bd0d393381edb5325a0bea88ed83dcd3d816dc213c6a6d17f88ff937af71be72004570894e427e4faf1b0d39448aa3a43'
            'SKIP')
b2sums=('dc7912c7d1782c3ffdf369cc7f0f004267bd2a2c408982909e654db14ecfa83ebdbd2f731c3d3ee8864e7de21945b1faa2f9d2845dedf3e742a4c79c62373eda'
        'SKIP')
validpgpkeys=('84FAA9983B24AEF24D6C87F1FEBB7D1812576482') # CISOfy (Software Signing Key) <software@cisofy.com>

prepare() {
  cd "$pkgname"
  sed -e 's|/path/to/lynis|/usr/bin/lynis|g' -i extras/systemd/lynis.service
}

package() {
  cd "$pkgname"

  # application
  install -Dm 755 lynis -t "${pkgdir}/usr/bin"
  install -Dm 644 default.prf -t "${pkgdir}/etc/${pkgname}"
  install -d "${pkgdir}/usr/share/${pkgname}"
  cp -ra db include plugins "${pkgdir}/usr/share/${pkgname}"

  # doc files
  install -Dm 644 README INSTALL CHANGELOG.md FAQ \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 "${pkgname}.8" -t "${pkgdir}/usr/share/man/man8"

  # completion
  install -Dm 644 extras/bash_completion.d/${pkgname} \
    -t "${pkgdir}/usr/share/bash-completion/completions"

  # systemd
  install -Dm 644 extras/systemd/{lynis.service,lynis.timer} \
    -t "${pkgdir}/usr/lib/systemd/system"
}

# vim: ts=2 sw=2 et:
